<!DOCTYPE html>
<html class="x-admin-sm">

{include file="common/static" /}
{include file="common/resources" /}
    <body>
        <div class="x-nav">
            <span class="layui-breadcrumb">
                <a href="">首页</a>
                <a href="">房间管理</a>
                <a>
                    <cite>房间信息</cite></a>
            </span>
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
                <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
            </a>
        </div>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                            <form class="layui-form layui-col-space5" method="get" action="">

                                <div class="layui-input-inline layui-show-xs-block">
                                    <select name="type_id" class="valid" >
                                        <option value="0">全部</option>
                                        {volist name='layout' id='v'}
                                        <option value="{$v.id}">{$v.type_name}</option>
                                        {/volist}
                                    </select>
                                </div>

                                <div class="layui-input-inline layui-show-xs-block">
                                    <input type="text" name="name" placeholder="请输入房间号" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-input-inline layui-show-xs-block">
                                    <button class="layui-btn" lay-submit="" lay-filter="sreach">
                                        <i class="layui-icon">&#xe615;</i></button>
                                </div>
                            </form>
                        </div>
                        <div class="layui-card-header">

                            <button class="layui-btn" onclick="xadmin.open('添加房间','/home/rooms/adds',500,700)">
                                <i class="layui-icon"></i>添加房间</button></div>
                        <div class="layui-card-body ">
                            <table class="layui-table layui-form" lay-even lay-skin="line">
                                <thead>
                                    <tr>
                                        <th>ID</th>
                                        <th>房间号码</th>
                                        <th>房间名称</th>
                                        <!-- <th>楼栋</th> -->
                                        <th>楼层</th>
                                        <th>房型</th>
                                        <th>价格/动态价格</th>
                                        <th>定金</th>
                                        <th>小时/价格</th>
                                        <th>早餐</th>
                                        <th>床位数</th>
                                        <th>电话</th>
                                        <!-- <th>描述</th> -->
                                        <th>创建时间</th>
                                        <th>操作</th></tr>
                                </thead>
                                <tbody>
                                {volist name='list' id='vo'}
                                    <tr>
                                        <td>
                                            <img src="/static/ico/id.png"/>
                                            {$vo.id}
                                        </td>
                                        <td>
                                            <img src="/static/ico/room_num.png"/>
                                            {$vo.room_num}
                                        </td>
                                        <td>
                                            <img src="/static/ico/room_name.png"/>
                                            {$vo.room_name}
                                        </td>
                                        <!-- <td>
                                            <img src="/static/ico/building.png"/>
                                            {$vo.building}
                                        </td> -->
                                        <td>
                                            {$vo.storey}
                                            <img src="/static/ico/storey.png"/>
                                        </td>
                                        <td>
                                            <img src="/static/ico/layout.png"/>
                                            {$vo.type_name}
                                        </td>
                                        <td>
                                            <img src="/static/ico/price.png"/>
                                            {$vo.price}/{$vo.monday}
                                        </td>
                                        <td>
                                            <img src="/static/ico/price.png"/>
                                            {$vo.deposit}
                                        </td>
                                        <td>
                                            <img src="/static/ico/price.png"/>
                                            {$vo.hour}
                                        </td>
                                        <td>
                                            <img src="/static/ico/breakfast.png"/>
                                            {if $vo['breakfast'] == '1' }有
                                            {else /} 无
                                            {/if}
                                        </td>
                                        <td>
                                            <img src="/static/ico/bed.png"/>
                                            {$vo.bed}
                                        </td>
                                        <td>
                                            <img src="/static/ico/tel.png"/>
                                            {$vo.tel}
                                        </td>
                                        <!-- <td>{$vo.desc}</td> -->
                                        <td>
                                            <img src="/static/ico/time.png"/>
                                            {:date('Y-m-d H:i:s',$vo.create_time)}
                                        </td>
                                        <td class="td-manage">
                                            <a title="查看" onclick="xadmin.open('编辑','/home/rooms/edits/id/'+{$vo.id},500,700)" href="javascript:;">
                                                <i class="layui-icon">&#xe63c;</i></a>
                                            <a title="删除" onclick="member_del(this,{$vo.id})" href="javascript:;">
                                                <i class="layui-icon">&#xe640;</i></a>
                                        </td>
                                    </tr>
                                {/volist}
                                </tbody>
                            </table>
                            {$list|raw}
                        </div>
<!--                        <div class="layui-card-body ">
                            <div class="page">
                                <div>
                                    <a class="prev" href="">&lt;&lt;</a>
                                    <a class="num" href="">1</a>
                                    <span class="current">2</span>
                                    <a class="num" href="">3</a>
                                    <a class="num" href="">489</a>
                                    <a class="next" href="">&gt;&gt;</a></div>
                            </div>
                        </div-->>
                    </div>
                </div>
            </div>
        </div>
    </body>

<script>layui.use(['laydate', 'form'],
        function() {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#start' //指定元素
            });

            //执行一个laydate实例
            laydate.render({
                elem: '#end' //指定元素
            });
        });

    /*楼层-删除*/
    function member_del(obj, id) {
        layer.confirm('确认要删除吗？',
            function(index) {
                $.ajax({
                    type:"post",
                    url: "{:url('home/rooms/deletes')}",
                    data: {
                        id:id
                    },
                    success: function(data){
                        console.log(data);
                        toastr.error(data.msg);
                        if(data.code == 100){

                            layer.closeAll();
                            $(obj).parents("tr").remove();
                            setTimeout(function () {
                                location.reload();
                            },1000);
                        }
                    }});
            });
    }

</script>


</html>